<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      {{num}}
      <button @click="btnClick">点我啊</button>
    </div>
    <script src="./vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          num: 0,
        },
        methods: {
          btnClick() {
            setTimeout(() => {
              this.num = 2;
              window.console.log(this.num);
            }, 0);
            this.$nextTick(() => {
              this.num = 3;
              window.console.log(this.num);
            });
            window.console.log(this.num);
          },
        },
      });
    </script>
  </body>
</html>
